package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.constant.Result;
import com.itheima.service.MemberService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author WNdeIdea
 * @version 1.0
 * @date 2020/10/15 14:21
 */
@RestController
@RequestMapping("/member")
public class MemberController {
    @Reference
    private MemberService member2Service;
    @RequestMapping("/getMemberAgeAndSex")
    @ResponseBody
    public Result getMemberAgeAndSex(){
        try{
            Map map=member2Service.getMemberAgeAndSex();
            return new Result(true, MessageConstant.GET_MEMBER_NUMBER_REPORT_SUCCESS,map);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,MessageConstant.GET_MEMBER_NUMBER_REPORT_FAIL);
        }
    }
}
